Skip to main content

Exploiting XXE using external entities to retrieve files

1

Let's check the stock of one of the products.

2

Since we are proxying the requests through Burp Suite, we can go to Proxy > HTTP History to view the request.

3

We can see that the request contains an XML entity.

Let's forward this request to the Repeater for further modification.

Once in the Repeater tab, declare the following internal entity after the XML prologue:

<!DOCTYPE test 
[<!ENTITY test "test_entity">]
>

And reference the entity within the <productId> tag as follows:

<productId>
&test;
</productId>

4

The response includes out test entity. This tells us that the application is vulnerable to XXE.

Now, in place of the internal entity, declare the following entity:

<!DOCTYPE test 
[<!ENTITY test SYSTEM "file:///etc/passwd">]
>

5

We have solved the lab.

7